package com.hhh.api.support;

import com.github.houbb.sensitive.word.api.IWordAllow;
import com.hhh.api.module.entity.WhiteList;
import com.hhh.api.module.service.WhiteListService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author binbin.hou
 * @since 1.1.0
 */
@Component
public class MyDdWordAllow implements IWordAllow {

    @Resource
    private WhiteListService whiteListService;

    @Override
    public List<String> allow() {
        List<String> whiteList = whiteListService.list().stream().map(WhiteList::getWord).collect(Collectors.toList());
        return whiteList;
    }

}
